<template>
  <div>
    <h3>Test1组件</h3>
    <div class="container">
      <van-pull-refresh v-model="isLoading" :head-height="80" @refresh="onRefresh">
  <!-- 下拉提示，通过 scale 实现一个缩放效果 -->
  <template #pulling="props">
    <img
      class="doge"
      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge.png"
      :style="{ transform: `scale(${props.distance / 80})` }"
    />
  </template>

  <!-- 释放提示 -->
  <template #loosing>
    <img
      class="doge"
      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge.png"
    />
  </template>

  <!-- 加载提示 -->
  <template #loading>
    <img
      class="doge"
      src="https://fastly.jsdelivr.net/npm/@vant/assets/doge-fire.jpeg"
    />
  </template>
  <p>刷新次数: {{ count }}</p>
</van-pull-refresh>
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      activeNames: '1',
    }
  },
  setup() {
    const count = 0;
    const loading = false;
    const onRefresh = () => {
      setTimeout(() => {
        showToast('刷新成功');
        loading = false;
        count++;
      }, 1000);
    };

    return {
      count,
      loading,
      onRefresh,
    };
  }
}
</script>

<style>
  .doge {
    width: 140px;
    height: 72px;
    margin-top: 8px;
    border-radius: 4px;
  }
  .container{
    height: 1000px;
    width: 100%;
    border: 1px solid #ccc;

  }
</style>